import request from '@/config/axios'

// 编码规则配置明细 VO
export interface CodeRuleSetVO {
  id: number // 主键
  codeRuleId: number // 编码规则主键
  ruleOrder: number // 规则顺序号
  rule: string // 规则
  ruleValue: string // 规则值
  orderNumDigit: number // 顺序号位数
  orderNumInitial: number // 顺序号初始值
}

// 编码规则配置明细 API
export const CodeRuleSetApi = {
  // 查询编码规则配置明细分页
  getCodeRuleSetPage: async (params: any) => {
    return await request.get({ url: `/mdm/code-rule-set/page`, params })
  },

  // 查询编码规则配置明细详情
  getCodeRuleSet: async (id: number) => {
    return await request.get({ url: `/mdm/code-rule-set/get?id=` + id })
  },

  // 新增编码规则配置明细
  createCodeRuleSet: async (data: CodeRuleSetVO) => {
    return await request.post({ url: `/mdm/code-rule-set/create`, data })
  },

  // 修改编码规则配置明细
  updateCodeRuleSet: async (data: CodeRuleSetVO) => {
    return await request.put({ url: `/mdm/code-rule-set/update`, data })
  },

  // 删除编码规则配置明细
  deleteCodeRuleSet: async (id: number) => {
    return await request.delete({ url: `/mdm/code-rule-set/delete?id=` + id })
  },

  // 导出编码规则配置明细 Excel
  exportCodeRuleSet: async (params) => {
    return await request.download({ url: `/mdm/code-rule-set/export-excel`, params })
  },
}